package service

import (
	"git.huoys.com/block_chain/mall/internal/promote/repository"
)

type Service interface {
	//为用户绑定上级
	BindPid(uid uint32, pid uint32) (map[uint32]uint32, error)
	//获取自己的下级
	GetDescendantByUid(uid uint32) (uint32, error)
	//获取自己全部下级 ps : 排好了顺序的
	GetAllDescendantByUid(uid uint32) ([]uint32, error)
	//获取自己的上级
	GetAncestorByUid(uid uint32) (uint32, error)
	//获取自己全部上级
	GetAllAncestorByUid(uid uint32) ([]uint32, error)
	// 每次交易时，给上级添加算力
	TradeAddPower(uid uint32) (map[uint32]uint32, error)
}

type server struct {
	repo repository.Repo
}

func NewService(pepo repository.Repo) Service {
	return &server{pepo}
}
